{{ template "layout/header" .}}
{{/*<script src="//cdn.ckeditor.com/4.12.1/basic/ckeditor.js"></script>*/}}
<main id="body">
    <div class="container">
        <div class="row">
            <div class="col-lg-9 main">
                <ol class="breadcrumb d-none d-md-flex">
                    <li class="breadcrumb-item"><a href="/" aria-label="首页"><i class="icon-home"></i></a></li>
                    <li class="breadcrumb-item"><a href="?forum-2.htm">自定义板块</a></li>
                    <li class="breadcrumb-item active"><a href="?thread-2.htm" title="首页返回主题第一页">{{.thread.Subject}}</a></li>
                </ol>
                <div class="card card-thread">
                    <div class="card-body">
                        <div class="media">
                            <a href="?user-1.htm" tabindex="-1">
                                <img class="avatar-3 mr-3" src="/static/img/avatar.png">
                            </a>
                            <div class="media-body">
                                <h4 class="break-all">
                                    {{.thread.Subject}}
                                </h4>
                                <div class="d-flex justify-content-between small">
                                    <div>
                                        <span class="username">
                                            <a href="?user-1.htm" class="text-muted font-weight-bold">{{.thread.User.Username}}</a>
                                        </span>
                                        <span class="date text-grey ml-2">{{.thread.CreatedAt.Format "2006-01-02 15:04:05"}}</span>
                                        <span class="text-grey ml-2"><i class="icon-eye"></i> 
											{{.thread.ViewsCnt}}</span>
                                    </div>
                                    <div>
                                        <a href="?post-update-3.htm" class="text-grey mr-2 post_update"><i class="icon-edit"></i> 编辑</a>
                                        <a data-href="?post-delete-3.htm" href="javascript:void(0);" class="text-grey post_delete" isfirst="1"><i class="icon-remove"></i> 删除</a>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="message break-all" isfirst="1">
                            {{printf "%v" .fpost.MessageFmt}}
                            <p>4</p>
                        </div>
                        <div class="plugin d-flex justify-content-center mt-3">
                        </div>
                    </div>
                </div>
                <div class="card card-postlist">
                    <div class="card-body">
                        <div class="card-title">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <b>最新回复</b> (<span class="posts">0</span>)
                                </div>
                                <div>
                                </div>
                            </div>
                        </div>
                        <ul class="list-unstyled postlist">
                            <li class="media post" data-pid="2" data-uid="2">
                                <a href="?user-2.htm" class="mr-3" tabindex="-1">
                                    <img class="avatar-3" src="upload/avatar/000/2.png?1563802634">
                                </a>
                                <div class="media-body">
                                    <div class="d-flex justify-content-between small text-muted">
                                        <div>
                                            <span style="padding-bottom:0;margin-bottom:0;color:; ">
                                                <i class="iconfont icon-v1" style="font-size: !important;">
                                                    管理员组 </i>
                                            </span>
                                            <span class="username">
                                                <a href="?user-2.htm" class="text-muted font-weight-bold">zhang</a>
                                            </span>
                                            <span class="date text-grey ml-2">4天前</span>
                                        </div>
                                        <div class="text-right text-grey">
                                            <style>
                                                .haya-post-like .haya-post-like-loved {
                                                    color: var(--secondary) !important;
                                                }
                                            </style>
                                            <span class="haya-post-like mr-3">
                                                <a href="javascript:;" class="text-muted haya-post-like-loved js-haya-post-like-post-del" data-pid="2" title="取消点赞">
                                                    <i class="icon icon-thumbs-up" aria-label="取消点赞"></i>
                                                    <span class="haya-post-like-post-user-count">1</span>
                                                </a>
                                            </span>
                                            <a href="javascript:void(0)" data-tid="1" data-pid="2" class="text-grey post_reply mr-3"><i class="icon-reply" title="引用"></i> <span class="d-none">引用</span></a>
                                            <a href="?post-update-2.htm" class="text-grey post_update mr-3"><i class="icon-edit" title="编辑"></i> <span class="d-none">编辑</span></a>
                                            <a data-href="?post-delete-2.htm" data-confirm-text="确定删除吗？" href="javascript:void(0);" class="text-grey post_delete _confirm mr-3"><i class="icon-remove" title="删除"></i> <span class="d-none">删除</span></a>
                                            <span class="floor-parent">
                                                <span class="floor mr-0">2</span>楼 </span>
                                        </div>
                                    </div>
                                    <div class="message mt-1 break-all">
                                        <p>评论1</p>
                                        1，公司配有简易上下铺，加班不用回家<br>2，老板是在校大学生，毫无管理可言，爱冲动，情商低<br>3，老板没有契约精神，在不交公积金的情况下已经扣了员工公积金<br>4，奇葩上班时间：早上8.50必须到，一分钟扣40，同事一个月被扣了1200
                                    </div>
                                </div>
                            </li>
                            <li class="post newpost media">
                                <a href="?user-1.htm" class="mr-3" tabindex="-1">
                                    <img class="avatar-3" src="/static/img/avatar.png">
                                </a>
                                <div class="media-body">
                                    <div class="d-flex justify-content-between small text-muted">
                                        <div>
                                            <div>admin</div>
                                        </div>
                                        <div>
                                            <span class="floor" id="newfloor">2</span>楼 </div>
                                    </div>
                                    <div>
                                        <form action="/api/v1/thread/{{.thread.ID}}/post" method="post" id="quick_reply_form" class="d-block">
                                            <input type="hidden" id="quotetid" name="threadid" value="{{.thread.ID}}">
                                            <input type="hidden" id="docutype" name="docutype" value="0">
                                            <div class="message mt-1">
                                                <textarea class="form-control" id="editor1" placeholder="内容" name="message" id="message"></textarea>
                                            </div>
                                            <div class="text-muted mt-2 small">
                                                <div class="d-flex justify-content-between">
                                                    <div>
                                                        <button id="tijiaoshuju" type="submit" class="btn btn-sm btn-secondary" id="submit" data-loading-text="正在提交..."> 回帖 </button>
                                                    </div>
                                                    <div>
                                                        <a class="icon-mail-forward text-muted" href="?post-create-2.htm" id="advanced_reply"> 高级回复</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="d-none threadlist"><input type="checkbox" name="modtid" value="2" checked=""></div>
                {{if .islogin}}
                <div class="text-center">
                    <div class="btn-group mod-button my-3" role="group" aria-label="">
                        <button class="btn btn-secondary delete" data-modal-url="?mod-delete.htm" data-modal-title="删除" data-modal-arg=".threadlist" data-modal-size="md">删除</button>
                        <button class="btn btn-secondary move" data-modal-url="?mod-move.htm" data-modal-title="移动" data-modal-arg=".threadlist" data-modal-size="md">移动</button>
                        <button class="btn btn-secondary top" data-modal-url="?mod-top.htm" data-modal-title="置顶" data-modal-arg=".threadlist" data-modal-size="md">置顶</button>
                        <button class="btn btn-secondary _close" data-modal-url="?mod-close.htm" data-modal-title="关闭" data-modal-arg=".threadlist" data-modal-size="md">关闭</button>
                        <button class="btn btn-secondary digest" data-modal-url="?mod-digest.htm" data-modal-title="精华" data-modal-arg=".threadlist" data-modal-size="md">精华</button>
                    </div>
                </div>
                {{end}}
                <a role="button" class="btn btn-secondary btn-block xn-back col-lg-6 mx-auto mb-3" href="javascript:history.back();">返回</a>
            </div>
            <div class="col-lg-3 d-none d-lg-block aside">
                <a role="button" class="btn btn-primary btn-block mb-3" href="?thread-create-2.htm">发新帖</a>
                <div class="card card-user-info">
                    <div class="m-3 text-center">
                        <a href="?user-1.htm" tabindex="-1">
                            <img class="avatar-5" src="{{.thread.User.Avatar}}">
                        </a>
                        <h5><a href="?user-1.htm">{{.thread.User.Username}}</a></h5>
                    </div>
                    <div class="card-footer p-2">
                        <table class="w-100 small">
                            <tbody>
                                <tr align="center">
                                    <td>
                                        <span class="text-muted">主题数</span><br>
                                        <b>{{.thread.User.ThreadsCnt}}</b>
                                    </td>
                                    <td>
                                        <span class="text-muted">帖子数</span><br>
                                        <b>{{.thread.User.PostsCnt}}</b>
                                    </td>
                                    <td>
                                        <span class="text-muted">精华数</span><br>
                                        <b>{{.thread.User.DigestsCnt}}</b>
                                    </td>
                                    <td>
                                        <span class="text-muted">注册排名</span><br>
                                        <b>{{.thread.User.ID}}</b>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
<script>
/*window.instansAnswer = CKEDITOR.replace('editor1', {
    language: 'zh-cn',
    disallowedContent: '<script >',
    // toolbar: [['Smiley']],
    // toolbarCanCollapse: true,
    toolbarStartupExpanded: false,
    toolbar: [
        // { name: 'document', items: [ 'Source', '-', 'NewPage', 'Preview', '-', 'Templates' ] },
        // { name: 'clipboard', items: [ 'Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord', '-', 'Undo', 'Redo' ] },
        // '/',
        // { name: 'basicstyles', items: [ 'Bold', 'Italic' ] }
    ],
    height: '8rem',
    resize_minHeight: '5rem',
});*/

// 输入框自动伸缩

var jmessage = $('#message');
jmessage.on('focus', function() {
    if (jmessage.t) {
        clearTimeout(jmessage.t);
        jmessage.t = null;
    }
    jmessage.css('height', '8rem');
});
jmessage.on('blur', function() { jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem'); }, 1000); });



var qrform = $("#quick_reply_form")
qrform.on('submit', function() {
    qrform.reset();
    jsubmit.button('loading');
    var postdata = qrform.serializeObject();
    // postdata.message = CKEDITOR.instances.editor1.getData();
    console.log(postdata)
    // postdata.password = $.md5(postdata.password);

    $.xpost(qrform.attr('action'), postdata, function(code, message) {
        console.log(code, ":", message)
        /*if (code == 0) {
            jsubmit.button(message).delay(1000).location(referer);
        } else if (xn.is_number(code)) {
            alert(message);
            jsubmit.button('reset');
            $.location("/index.html")
        } else {
            jform.find('[name="' + code + '"]').alert(message).focus();
            jsubmit.button('reset');
        }*/
    });

    return false;
});
</script>
{{ template "layout/footer" .}}